//
//  JMFormDescriptor.h
//  SYPerfectDemo
//
//  Created by Lssyyy on 2019/7/31.
//  Copyright © 2019年 Lssyyy. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "JMFormSectionDescriptor.h"
#import "JMFormDescriptorDelegate.h"
#import "JMFormRowDescriptor.h"
#import "JMFormDescriptorCell.h"
typedef NS_ENUM(NSInteger, JMFormErrorCode)
{
    JMFormErrorCodeGen = -999,
    JMFormErrorCodeRequired = -1000
};

typedef NS_OPTIONS(NSUInteger, JMFormRowNavigationOptions) {
    JMFormRowNavigationOptionNone                               = 0,
    JMFormRowNavigationOptionEnabled                            = 1 << 0,
    JMFormRowNavigationOptionStopDisableRow                     = 1 << 1,
    JMFormRowNavigationOptionSkipCanNotBecomeFirstResponderRow  = 1 << 2,
    JMFormRowNavigationOptionStopInlineRow                      = 1 << 3,
};


@interface JMFormDescriptor : NSObject


@property (readonly, nonatomic, nonnull) NSMutableArray * formSections;
@property (readonly, nullable) NSString * title;
@property (nonatomic) BOOL endEditingTableViewOnScroll;
@property (nonatomic) BOOL assignFirstResponderOnShow;
@property (nonatomic) BOOL addAsteriskToRequiredRowsTitle;
@property (getter=isDisabled) BOOL disabled;
@property (nonatomic) JMFormRowNavigationOptions rowNavigationOptions;
@property (weak, nullable) id<JMFormDescriptorDelegate> delegate;



+(nonnull instancetype)formDescriptor;
+(nonnull instancetype)formDescriptorWithTitle:(nullable NSString *)title;
-(void)addFormSection:(JMFormSectionDescriptor *)formSection;

-(nullable JMFormRowDescriptor *)formRowAtIndex:(nonnull NSIndexPath *)indexPath;
-(NSIndexPath *)indexPathOfFormRow:(JMFormRowDescriptor *)formRow;
- (void)setFirstResponder:(JMFormBaseViewController *)formViewController;

-(void)forceEvaluate;
@end
